﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JXT.PrimaryKey.Batman.Core.OAuth
{
    /// <summary>
    /// Rest访问OAuth接口
    /// </summary>
    public interface IRestAuth
    {
        /// <summary>
        /// 认证上下文对象
        /// </summary>
        AuthContext Context { get; }

        /// <summary>
        /// 创建认证URL
        /// </summary>
        /// <param name="requestTokeUri">请求token的URL</param>
        /// <param name="authorizeUri">认证URL</param>
        /// <param name="callback">返回请求URL</param>
        /// <param name="isEnforce">是否设置为enforce</param>
        /// <returns>认证URL</returns>
        string GetAuthorizeUri(Uri requestTokeUri, Uri authorizeUri, Uri callback, bool isEnforce = false);

        /// <summary>
        /// OAuth第一次认证
        /// </summary>
        /// <param name="accessTokeUri">URL</param>
        /// <param name="verifier">verifier</param>
        void AccessTokenUserId(Uri accessTokeUri, string verifier);

        /// <summary>
        /// OAuth第二次认证
        /// </summary>
        /// <param name="accessTokeUri">accessURL</param>
        /// <param name="verifier">verifier</param>
        /// <param name="token">token</param>
        /// <param name="tokensecret">tokensecret</param>
        void AccessTokenUserId(Uri accessTokeUri, string verifier, string token, string tokensecret);

        /// <summary>
        /// 创建GET请求URLURL
        /// </summary>
        /// <param name="baseUri">基本URL</param>
        /// <param name="parameters">参数</param>
        /// <returns>URL内容</returns>
        string CreateGetUrl(Uri baseUri, IDictionary<string, string> parameters = null);

        /// <summary>
        /// 获取REST请求内容
        /// </summary>
        /// <param name="baseUri">请求URL</param>
        /// <param name="parameters">参数</param>
        /// <returns>请求内容</returns>
        string GetRestResponse(Uri baseUri, IDictionary<string, string> parameters = null);

      
    }
}
